package book_management.user;

import book_management.operation.IOperation;
import book_management.operation.impl.BorrowOperation;
import book_management.operation.impl.FindOperation;
import book_management.operation.impl.ListOperation;
import book_management.operation.impl.ReturnOperation;

import java.util.Scanner;

public class Normal extends User{
    private Scanner scanner = new Scanner(System.in);

    public Normal(String name) {
        this.name = name;
        this.iOperations = new IOperation[]{
                //查看书籍列表
                new ListOperation(),
                //查询书籍
                new FindOperation(),
                //借书
                new BorrowOperation(),
                //还书.
                new ReturnOperation()
        };
    }

    @Override
    public int menu() {
        System.out.println("=============================");
        System.out.println("欢迎"+this.name+"登录图书管理系统");
        System.out.println("1.查看书籍列表");
        System.out.println("2.查询书籍");
        System.out.println("3.借书");
        System.out.println("4.还书");
        System.out.println("-1,退出系统");
        System.out.println("请输入你的选择：");
        int choice = scanner.nextInt();
        if (choice==-1){
            scanner.close();
        }
        System.out.println("=============================");
        return choice;
    }
}
